package com.iloomo.dao.core.impl;

import com.iloomo.dao.DaoSupport;
import com.iloomo.dao.core.CoreBusinessDao;
import com.iloomo.util.PageData;
import com.iloomo.util.PagerModel;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/** 
 * 说明：表 coreBusiness数据处理实现类
 * 创建人：system
 * 创建时间：2019-04-29
 * @version
 */
@Repository("coreBusinessDao")
public class CoreBusinessDaoImpl implements CoreBusinessDao{

	@Resource(name = "daoSupport")
	private DaoSupport dao;

	/**新增
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public int save(PageData pd) throws Exception{
		return (Integer)dao.save("coreBusinessMapper.save", pd);
	}
	
	/**删除
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public int deleteById(PageData pd) throws Exception{
		return (Integer)dao.delete("coreBusinessMapper.deleteById", pd);
	}
	
	/**修改
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public int updateById(PageData pd) throws Exception{
		return (Integer)dao.update("coreBusinessMapper.updateById", pd);
	}
	
	/**通过id获取数据
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public Map findById(PageData pd) throws Exception{
		return (Map) dao.findForObject("coreBusinessMapper.findById", pd);
	}
	
	/**列表(分页)
	 * @param
	 * @ throws Exception
	 */
	@Override
	public PagerModel list(PageData pd) throws Exception{
		return dao.selectPageList("coreBusinessMapper.list", "coreBusinessMapper.listCount", pd);
	}
	
	/**列表(全部)
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public List<Map> listAll(PageData pd) throws Exception{
		return (List<Map>) dao.findForList("coreBusinessMapper.listAll",pd);
	}
}

